package org.swim.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="notifiche")
@SequenceGenerator(name="NOTIFICATION_SEQUENCE", sequenceName="NO_SEQ", allocationSize = 1, initialValue=1)
public class Notification {
	
	@Id
	@Column(name="idNotifica")
	@GeneratedValue(strategy=GenerationType.AUTO, generator="NOTIFICATION_SEQUENCE")
	private int notificationID;
	
	@Column(name="testoNotifica")
	private String text;
	
	@ManyToOne
	@JoinColumn(name="idDestinatario", referencedColumnName="idUtente")
	private User recipient;
	
	@ManyToOne
	@JoinColumn(name="idMittente", referencedColumnName="idUtente")
	private User sender;
	
	
	public int getNotificationID() {
		return notificationID;
	}
	
	public String getText()
	{
		return text;
	}
	
	public void setText(String toSet)
	{
		this.text=toSet;
	}
	
	public User getRecipient()
	{
		return this.recipient;
	}
	
	public void setRecipient(User rec)
	{
		this.recipient=rec;
	}
	
	public User getSender()
	{
		return this.sender;
	}
	
	public void setSender(User sen)
	{
		this.sender=sen;
	}

}
